package com.tian.enums;

import lombok.Getter;

import java.io.Serializable;

/**
 * {@code @description:} 返回码
 *
 * @author tianwc 公众号：Java后端技术全栈
 * 在线刷题 1200+java面试题和1000+篇技术文章：<a href="https://woaijava.cc/">博客地址</a>
 * {@code @date:} 2024-07-28 15:10
 * {@code @version:} 1.0
 */
@Getter
public enum ResultCode implements Serializable {
    SUCCESS(200000, "成功"),

    FAIL(500000, "服务器内部错误"),

    USER_NOT_EXIST(401000, "用户不存在"),
    USER_CANCELLED(401001, "用户已注销"),
    USER_ROLE_ERROR(401002, "用户角色不对"),
    USER_NAME_OR_PASSWORD_ERROR(401003, "用户名或密码有误"),
    UNAUTHORIZED(400104, "暂未登录或token已经过期"),
    USER_NAME_EXIST(400105, "用户名已存在"),
    ROLE_USED(400106, "该角色已分配给用户，不能删除"),
    ROLE_NAME_EXIST(400107, "角色名已存在"),
    NO_ACCESS_PERMISSION(400108, "没有访问权限"),
    MENU_NOT_NULL(400109, "菜单不能为空"),

    NOT_FOUND(404000, "接口不存在"),
    PARAMETER_ERROR(404001, "参数有误"),
    PARAMETER_IS_NULL(404002, "参数为空");

    private final int code;
    private final String message;

    ResultCode(int code, String message) {
        this.code = code;
        this.message = message;
    }
}
